/* ---------------------------------------------------------------------------
   (c) Copyright 2006 ActivIdentity, Inc.
   All Rights Reserved.

   This program is an unpublished copyrighted work which is proprietary
   to ActivIdentity. This computer program includes Confidential,
   Proprietary Information and is a Trade Secret of ActivIdentity.
   Any use, disclosure, modification and/or reproduction is prohibited
   unless authorized in writing by ActivIdentity.

   WARNING:  Unauthorized reproduction of this program as well as
   unauthorized preparation of derivative works based upon the
   program or distribution of copies by sale, rental, lease or
   lending are violations of federal copyright laws and state trade
   secret laws, punishable by civil and criminal penalties.
   --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   Disclaimer

   ACTIVIDENTITY MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE 
   CONTENTS OR USE OF THIS SOFTWARE, AND SPECIFICALLY DISCLAIMS ANY EXPRESS
   OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
   PURPOSE. Further, ActivIdentity reserves the right to revise this software
   and to make changes to its content, at any time, without obligation to
   notify any person or entity of such revisions or changes.
   --------------------------------------------------------------------------- */

#ifndef __SDBSKI_H__
#define __SDBSKI_H__

#ifdef __cplusplus
extern "C" {
#endif

#if defined(WIN32)
/* Windows standard files and definitions */
#include <windows.h>
#else
/* Unix standard files and definitions */
#include <stdio.h>
#define CALLBACK
#define TRUE 1
#define FALSE 0
#endif


#include <stdio.h>
#include "actoken.h"
#include "sdbapi.h"
#include "acm.h"

/***************/
/** CONSTANTS **/
/***************/
#define SDB_TOKEN_MESSAGEARRAY_SIZE	((12+1)*47)

#define SDB_VERSION_LOWER_SDK_13	10
#define SDB_VERSION_SDK_13			20

/************/
/** MACROS **/
/************/


/***************/
/** FUNCTIONS **/
/***************/
int CALLBACK SDBSKIGetVersion(
        OUT char *pszVersion,
        OUT unsigned int *plVersion,
        OUT char *pszCopyright, 
        OUT char *pszComment);
        
int CALLBACK SDBSKISDB2PlainParam(
        IN const char *pszKey,
        IN PSDB pSdb,
        IN unsigned int ServiceType,
        IN const char *pszServiceName,
        IN int PlainParamStructSize,
        OUT void *pPlainParamStruct);

int CALLBACK SDBSKIPlainParam2SDB(
        IN const char *pszKey,
        IN int PlainParamStructSize,
        IN void *pPlainParamStruct,
        IN unsigned int ServiceType,
        IN const char *pszServiceName,
        INOUT PSDB pSdb);

/* Deprecated */

int CALLBACK SDBSKISDB2EMV(
		IN const char *pszKey,
		IN PSDB pSdb,
		IN unsigned int nServiceType,
		IN unsigned short nServicePart,
		IN const char *pszServiceName,
		OUT strEMVAuth *sAuthAsync);

int CALLBACK SDBSKIEMV2SDB(
		IN const char *pszEncryptionKey,
		INOUT PSDB pSDB,
		IN unsigned int ServiceType,
		IN unsigned short ServicePart,
		IN const char *pszServiceName,
		IN strEMVAuth *sAuthAsync);

int CALLBACK SDBSKISDB2strStruct(
        IN const char *pszKey,
        IN PSDB pSdb,
        OUT strToken *psToken,
        OUT strSlot *psSlot);

int CALLBACK SDBSKIstrStruct2SDB(
        IN const char *pszKey,
        IN strToken *psToken,
        IN strSlot *psSlot,
        INOUT PSDB pSdb);

int CALLBACK SDBSKISDB2ExtstrStruct(
        IN const char *pszKey,
        IN PSDB pSdb,
        OUT strToken *psToken,
        OUT strExtSlot *psExtSlot);

int CALLBACK SDBSKIExtstrStruct2SDB(
        IN const char *pszKey,
        IN strToken *psToken,
        IN strExtSlot *psExtSlot,
        INOUT PSDB pSdb);

int CALLBACK SDBSKIConvertSDB(
        IN const char *pszKey,
        INOUT PSDB pSdb,
		IN const unsigned int unDestVersion);

#ifdef __cplusplus
}
#endif

#endif /* __SDBSKI_H__ */
